package com.zsrt.java.day20161226.hzj.lasthomework;

import java.util.Scanner;
/**
 * 乘法表
 * @author Administrator
 *
 */
public class chenfabiao {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
		System.out.println("输入乘法表大小1~9");
		int s = sc.nextInt();
		if(s>9||s<1){
			System.out.println("重新输入");
		}
		else{
			fj(s);
			break;			
		}
		}
		sc.close();
	}
	public static void fj(int x){
		//while 打印	
		    int a=1;	
			while(a<=x){
				int b=a;
				while(b<=x){
					int sum =a*b;
				    System.out.print(a+"*"+b+"="+sum+"\t");	
				    b++;	
				}
			 System.out.println();		
			 a++;
			}
			
			 System.out.println("--------------");
			
			int b=1;
			do{
				int b1=b;
				do{
					int sum =b*b1;
				    System.out.print(b+"*"+b1+"="+sum+"\t");	
				    b1++;
				}while(b1<=x);
				 System.out.println();		
				 b++;
			}
			while(b<=x);
		 System.out.println("--------------");
		//for 打印	
			for(int i=1;i<=x;i++){
				for(int b1=i;b1<=x;b1++)
				{
					System.out.print(i+"*"+b1+"="+(i*b1)+"\t");
				}
				System.out.println();
			    
			}
		 System.out.println("--------------");	
		}
}
